
#ifndef __TESTRING_H__
#define __TESTRING_H__

#include <string>
#include <vector>
using namespace std;

// Converts a string to a value
int GetInt(const string &str);
float GetFloat(const string &str);

// Tokenizes a string
void Tokenize(const string& str,
              vector<string>& tokens,
              const string& delimiters = " ");

// Tokenizes a wstring
void Tokenize(const wstring& str,
              vector<wstring>& tokens,
              const wstring& delimiters = L" ");

// Converts string to a TCHAR pts, max 50 characters
wchar_t *ConvertToTChar(const string &_str);
extern wchar_t str[512];

// Macro to use to time a method call
#define TimeMethod(X)																		  \
{																												  \
	DWORD t0 = GetTickCount();														  \
	X;																										  \
	DWORD t1 = GetTickCount();														  \
	TCHAR str[40];																				  \
	if(t1-t0 > 1000)																			  \
		StringCchPrintf(str, 40, L"%s: %ld s", L#X, (t1-t0) / 1000);	\
	else																									  \
		StringCchPrintf(str, 40, L"%s: %ld ms", L#X, t1-t0);	\
	MessageBox(0, str, L"Timing Method", 0);							  \
}

#endif // __TESTRING_H__